#ifndef RESAHOTELGUI_H
#define RESAHOTELGUI_H

#include <list>
#include <string>
#include <sstream>

#include <Qt\qicon.h>
#include <Qt\qpixmap.h>
#include <Qt\qmainwindow.h>
#include <Qt\qboxlayout.h>
#include <Qt\qaction.h>
#include <Qt\qmenubar.h>
#include <Qt\qdockwidget.h>
#include <Qt\qbuttongroup.h>
#include <Qt\qradiobutton.h>
#include <Qt\qpushbutton.h>
#include <Qt\qkeysequence.h>
#include <Qt\qprogressdialog.h>

#include "Properties.h"
#include "Reservation.h"
#include "PropertiesDialog.h"
#include "HotelRadioButton.h"
#include "MailPreview.h"
#include "MailerThread.h"

class ResaHotelGUI : public QMainWindow{
	Q_OBJECT
public :
	const QIcon APP_ICON;
	const QIcon OK_ICON;
	const QIcon CANCEL_ICON;
	const QIcon SELECT_ALL_ICON;
	const QIcon UNSELECT_ALL_ICON;
	const QIcon PREV_MAIL_ICON;
	const QIcon SEND_MAIL_ICON;
	const QIcon ADD_CONS_ICON;
	const QIcon EDIT_CONS_ICON;
	const QIcon REMOVE_CONS_ICON;
	const QIcon ADD_HOTEL_ICON;
	const QIcon EDIT_HOTEL_ICON;
	const QIcon REMOVE_HOTEL_ICON;

private :
	QDockWidget* resaDockWidget;
	QDockWidget* hotelDockWidget;
	QProgressDialog* progressDialog;
	MailerThread* mailerThread;

	Properties* properties;
	PropertiesDialog* propsDial;
	std::list<Reservation*>* reservations;
	std::list<HotelRadioButton*>* hotelButtons;

	void prepareReservations(void);
	void prepareHotels(void);

	ResaHotelGUI(const ResaHotelGUI&) {}

public :
	ResaHotelGUI(void);
	
	virtual ~ResaHotelGUI(void){
		//TODO
		delete(properties);
		
		if(reservations){
			reservations->clear();
		}

		delete(reservations);

		if(hotelButtons){
			hotelButtons->clear();
		}

		delete(hotelButtons);
	}

	bool canLaunch(void) const;
	void showActivity(void);
	void hideActivity(void);

	void showMailSendSucces(void);
	void showMailSendFailure(void);
	void askDifferentAttempt(void);

	const QIcon& appIcon(void) const { return APP_ICON; }
	const QIcon& okIcon(void) const { return OK_ICON; }
	const QIcon& cancelIcon(void) const { return CANCEL_ICON; }
	const QIcon& selectAllIcon(void) const { return SELECT_ALL_ICON; }
	const QIcon& unSelectAllIcon(void) const { return UNSELECT_ALL_ICON; }
	const QIcon& preMailIcon(void) const { return PREV_MAIL_ICON; }
	const QIcon& sendMailIcon(void) const { return SEND_MAIL_ICON; }
	const QIcon& addConsIcon(void) const { return ADD_CONS_ICON; }
	const QIcon& editConsIcon(void) const { return EDIT_CONS_ICON; }
	const QIcon& removeConsIcon(void) const { return REMOVE_CONS_ICON; }
	const QIcon& addHotelIcon(void) const { return ADD_HOTEL_ICON; }
	const QIcon& editHotelIcon(void) const { return EDIT_HOTEL_ICON; }
	const QIcon& removeHotelIcon(void) const { return REMOVE_HOTEL_ICON; }
	
public slots:
	void showPropertiesDialog(bool);
	void selectAll(bool);
	void unSelectAll(bool);
	void prepareMail(bool);
	void mailerThreadFinished(void);
};

#endif